<?php
require_once ('checks.php');

?>	
		<form method="post" action="?page=admin_add_article">
			<table>
			
			<tr>
					<td>
						<label for="article_name">Article Name : </label>
					</td>
					<td colspan="2">	
						<input type="text" name="article_name" id="article_name">
					</td>
				</tr>
				<tr>
					<td style="vertical-align:top;">
						<label for="article" >Article : </label>
					</td>
					<td colspan="2">	
						<textarea name="article" id="article" cols="70" rows="20" >
						</textarea>

					</td>
				</tr>
								<tr>
					<td>
						
					</td>
					<td ><input type="submit" value="Save" name="go">
						<input type="button" value="Home"  onclick="location.href='?page=admin_index'">
					</td>				
				</tr>			
			</table>
		</form>

<?php
	if (isset($_POST['go']) || isset($_POST['article_name'])) {
			require_once ('Database.php');
			require_once ('Articles.php');
			$db= new DB();
			$article= new Article($_POST['article_name'],$_POST['article']);								
			$db->addArticle( $article);  
	}
?>
